package com.example.myDesignPatterns.行为型模式.责任链模式Responsibility;

//小组长
public class GroupLeader extends Handler {
    public GroupLeader() {
//小组长处理1-3天的请假
        super(Handler.NUM_ONE, Handler.NUM_THREE);
    }
    @Override
    protected void handleLeave(LeaveRequest leave) {
        System.out.println(leave.getName() + "请假" + leave.getNum() +
                "天," + leave.getContent() + "。");
        System.out.println("小组长审批：同意。");
    }
}
//部门经理
class Manager extends Handler {
    public Manager() {
//部门经理处理3-7天的请假
        super(Handler.NUM_THREE, Handler.NUM_SEVEN);
    }
    @Override
    protected void handleLeave(LeaveRequest leave) {
        System.out.println(leave.getName() + "请假" + leave.getNum() +
                "天," + leave.getContent() + "。");
        System.out.println("部门经理审批：同意。");
    }
}
//总经理
class GeneralManager extends Handler {
    public GeneralManager() {
//部门经理处理7天以上的请假
        super(Handler.NUM_SEVEN);
    }

    @Override
    protected void handleLeave(LeaveRequest leave) {
        System.out.println(leave.getName() + "请假" + leave.getNum() +
                "天," + leave.getContent() + "。");
        System.out.println("总经理审批：同意。");
    }
}